using System.Globalization;
using System.Xml.Serialization;

namespace HengTong.Kingdee.WSWMSImportBillFacadeSrvProxyService
{
    /// <summary>
    /// EAS 仓库数据信息
    /// </summary>
    [XmlRoot("DataInfo")]
    public class EasWarehouseDataInfo
    {
        [XmlElement("DataHead")]
        public EasWarehouseDataHead DataHead { get; set; }
    }

    /// <summary>
    /// EAS 仓库数据头
    /// </summary>
    public class EasWarehouseDataHead
    {
        /// <summary>
        /// 地区
        /// </summary>
        [XmlElement("region")]
        public string Region { get; set; }

        /// <summary>
        /// 创建时间（原始字符串）
        /// </summary>
        [XmlElement("createTime")]
        public string CreateTimeString { get; set; }

        /// <summary>
        /// 创建时间（DateTime 类型）
        /// </summary>
        [XmlIgnore]
        public DateTime? CreateTime
        {
            get
            {
                if (string.IsNullOrWhiteSpace(CreateTimeString))
                    return null;
                if (DateTime.TryParseExact(CreateTimeString, "yyyy-MM-dd HH:mm:ss",
                    CultureInfo.InvariantCulture, DateTimeStyles.None, out var result))
                    return result;
                return null;
            }
        }

        /// <summary>
        /// 简称
        /// </summary>
        [XmlElement("simpleName")]
        public string SimpleName { get; set; }

        /// <summary>
        /// 是否有库位层级
        /// </summary>
        [XmlElement("hasLocationLevel")]
        public int HasLocationLevel { get; set; }

        /// <summary>
        /// 控制单元
        /// </summary>
        [XmlElement("CU")]
        public string CU { get; set; }

        /// <summary>
        /// 发送消息
        /// </summary>
        [XmlElement("sendMsg")]
        public string SendMsg { get; set; }

        /// <summary>
        /// 最后更新时间（原始字符串）
        /// </summary>
        [XmlElement("lastUpdateTime")]
        public string LastUpdateTimeString { get; set; }

        /// <summary>
        /// 最后更新时间（DateTime 类型）
        /// </summary>
        [XmlIgnore]
        public DateTime? LastUpdateTime
        {
            get
            {
                if (string.IsNullOrWhiteSpace(LastUpdateTimeString))
                    return null;
                if (DateTime.TryParseExact(LastUpdateTimeString, "yyyy-MM-dd HH:mm:ss",
                    CultureInfo.InvariantCulture, DateTimeStyles.None, out var result))
                    return result;
                return null;
            }
        }

        /// <summary>
        /// 最后更新用户
        /// </summary>
        [XmlElement("lastUpdateUser")]
        public string LastUpdateUser { get; set; }

        /// <summary>
        /// 传输状态
        /// </summary>
        [XmlElement("transState")]
        public int TransState { get; set; }

        /// <summary>
        /// 编号
        /// </summary>
        [XmlElement("number")]
        public string Number { get; set; }

        /// <summary>
        /// 仓库管理员
        /// </summary>
        [XmlElement("whman")]
        public string Whman { get; set; }

        /// <summary>
        /// 仓储组织
        /// </summary>
        [XmlElement("storageOrg")]
        public string StorageOrg { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [XmlElement("creator")]
        public string Creator { get; set; }

        /// <summary>
        /// 仓库状态
        /// </summary>
        [XmlElement("whState")]
        public int WhState { get; set; }

        /// <summary>
        /// 是否有库位
        /// </summary>
        [XmlElement("hasLocation")]
        public int HasLocation { get; set; }

        /// <summary>
        /// 地址
        /// </summary>
        [XmlElement("address")]
        public string Address { get; set; }

        /// <summary>
        /// 联系电话
        /// </summary>
        [XmlElement("telPhone")]
        public string TelPhone { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        [XmlElement("description")]
        public string Description { get; set; }

        /// <summary>
        /// 是否允许负库存
        /// </summary>
        [XmlElement("isNegative")]
        public int IsNegative { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        [XmlElement("name")]
        public string Name { get; set; }

        /// <summary>
        /// 发送次数
        /// </summary>
        [XmlElement("sendCount")]
        public int SendCount { get; set; }

        /// <summary>
        /// 默认库位组
        /// </summary>
        [XmlElement("defaultLocationGroup")]
        public string DefaultLocationGroup { get; set; }

        /// <summary>
        /// 是否发送
        /// </summary>
        [XmlElement("isSend")]
        public int IsSend { get; set; }
    }
}

